package base;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

/**
 * @Author DRevelation
 * @Date 2020-07-01 下午 17:10
 * @Desc
 */
public class BockingQueueDemo {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<String> queue = new ArrayBlockingQueue(5);
        queue.put("a");
        queue.offer("b");
        System.out.println(queue);
        for (int i = 0; i < 5; i++) {
            if (queue.size() != 0) {
                System.out.println(queue.take());
            }
        }
        System.out.println(queue);
    }
}
